<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
.input{
display: block;
width: 40px;
height: 35px;
float: left;
margin-left: 10px;
}
</style>
</head>
<body>
	<div id="body">
<input type="text" maxlength="1" class="input">
<input type="text" maxlength="1" class="input">
<input type="text" maxlength="1" class="input">
<input type="text" maxlength="1" class="input">
<input type="text" maxlength="1" class="input">
<input type="text" maxlength="1" class="input">
</div>
</body>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
 
<script>
$(function(){
var inputLength = $('input').length;
//$('input').keyup(function(){})
//使用jQuery事件代理的事件绑定方式，不需要对每个input进行事件绑定，有利于性能优化
$('#body').delegate('input','keyup',function(){
var _this = $(this),valLength = _this.val().length,index = _this.index();
if(valLength>0){
if((index+1) > inputLength) return false;//输入完成时进行操作
_this.attr('data-in','true').next().focus();
}else if(valLength == 0 && _this.attr('data-in') == 'true'){
if(index == 0) return false;//删除所有时进行操作
_this.attr('data-in','false').prev().focus();
}
});
});


var stringFromPerson = JSON.stringify(person);
/* stringFromPerson 结果为 "{"name":"Saad","age":26,"department":{"ID":15,"name":"R&D"}}" */
var personFromString = JSON.parse(stringFromPerson);
/* personFromString 的值与 person 对象相同 */

console.log(numbersArray.splice(from,2));
</script>
</html>